Repository navigation
Add JSON Schema checks for output acceptance - #6383
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (2)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 58eff6912a
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
No actionable findings. Reviewed schema isolation, local-reference restrictions, non-finite and duplicate-key JSON rejection, unresolved references, and output-acceptance integration.
Comprehensive static review with independent review. No candidate code or tests were run locally. Hosted CI has no failures observed; some checks are still running.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Updating my earlier approval after independently validating the existing finding: #6383 (comment)
The async check executes validator.is_valid synchronously without a suspension point or work bound. Accepted pattern/patternProperties schemas can therefore cause unbounded regex matching on model-controlled text, blocking other tasks and preventing an asyncio timeout from taking effect. A trusted application schema does not by itself bound regex matching complexity. Please constrain supported regex validation or move it behind a genuinely preemptible, bounded isolation boundary before approval.
This supersedes my earlier approval. Static review only, with independent confirmation; no candidate code or tests were executed. Referencing the existing inline finding rather than duplicating it.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
The regex validation finding is addressed: pattern and patternProperties are rejected throughout schema subresources, and references are restricted to checked direct local definitions. Reviewed annotation-reference bypasses and ordinary data fields with those names.
No new actionable findings after independent static re-review. This approval supersedes my earlier request for changes. Hosted CI is still in progress; no candidate code or tests were executed locally.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: acffba995f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: acffba995f
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Superseding my earlier approval after independently validating two additional existing findings:
- Fractional multipleOf constraints can reject valid decimal JSON numbers because parsing and the pinned validator use binary-float division: #6383 (comment) . Please use decimal-safe validation for both instance values and schema constraints.
- Permitted recursive references combined with branching schemas can repeatedly validate the same child, causing exponential synchronous work on model-controlled output. The regex restriction does not bound this work, and an asyncio timeout cannot preempt it: #6383 (comment) . Please reject unsafe recursive/multiplying schemas or enforce a preemptible work bound.
Static review with independent confirmation against the pinned validator implementation; no candidate code or tests were executed. Referencing existing inline findings rather than duplicating them.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Both remaining findings are addressed. Schema and instance decimals now use exact Fraction/int arithmetic; recursive and multiplying reference expansions are bounded at construction, and candidate size/depth plus the combined schema/input budget are checked before validation. Reviewed the restriction and numeric boundary regressions, unsupported-keyword traversal, and existing acceptance behavior.
No new actionable findings after independent static re-review. This approval supersedes my request for changes. Hosted CI remains in progress; no candidate code or tests were executed locally.
Summary
This PR adds
json_schema_check, a reusable check foraccept_outputthat validates settled JSON against an application schema. The helper supports a bounded subset of JSON Schema, checks numeric constraints with exact arithmetic, and rejects recursive or excessive reference expansion during construction. See the docstring for supported features and resource limits. Applications control acceptance and retries. The check leaves the candidate text unchanged.Test plan
All 81 isolated tests in
test_json_output.pypassed, covering runs and streams, optional fields, defaults, decimal multiples, ordinary field names, recursive references, acyclic reference multiplication, and input budgets.The full verification script ran on all five changes together. Formatting, lint, mypy for Linux and Windows, and Pyright passed. All 325 focused tests passed.
make testsreported 504 passes and five failures involving a command hook, sandbox file writes, and a subagent. The same five tests failed on unmodifiedv1-alpha. This workspace blocks user namespace mapping.Issue number
None
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR